package entjava.poker.model;

public class Deck {
	
	   private String[] suitName = { "Spade","Club","Heart","Diamond"};
	   private String[] cardValue ={ "Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"};   
	   private int[] valueNum = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10}; //the value number
	   private int[] suitNum =  { 1, 2, 3, 4 }; //suit number
	   private int[] rankNum =  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };  //rank number
	   
	   private Card[] cards = new Card[52];
	   private String[] suffix={"s.gif", "c.gif", "h.gif", "d.gif"};
	   private String[] prefix={"./Images/a", "./Images/2", "./Images/3", "./Images/4", "./Images/5", "./Images/6","./Images/7", "./Images/8","./Images/9", 
			   "./Images/t", "./Images/j", "./Images/q", "./Images/k" };
	     
	   private int count=0;
	   private int drawCount=0;	
	   
	   public Deck(){
		 for(int j=0; j< suitName.length; j++ ) {
	  	   for (int i = 0; i < cardValue.length; i++){
				cards[count] = new Card(suitName[j], cardValue[i], prefix[i],suffix[j], rankNum[i], suitNum[j]);        
				count++;
	      	}
	      }

		 	

		}
	
	   public void shuffleCard() {
			  
			for (int i = 0; i < cards.length; i++) {
			       int a = (int) (Math.random() * i);
			       Card swap = cards[i];
			       cards[i]  = cards[a];
			       cards[a]  = swap;
			   	 }
			System.out.println("deck was shuffled");
		  }
		
		public Card drawCard(){
			 
			 int dCard = drawCount++;
			 Card aCard = cards[dCard];
			 return aCard; 
		 }	 
	}
